<?php
class PartnersModule extends fvModule {

	function __construct () {
	    $moduleName = strtolower(substr(__CLASS__, 0, -6));
	    parent::__construct(fvSite::$fvConfig->get("modules.{$moduleName}.smarty.template"), 
	                        fvSite::$fvConfig->get("modules.{$moduleName}.smarty.compile"), 
	                        fvSite::$Layoult);
	}
	
	function showIndex($params) {
	    $pager = new fvPager(PartnersManager::getInstance());
        $this->__assign('Partners', $pager->paginate('lang="'.fvSite::$fvSession->get("lang").'"'));
        return $this->__display("partners_index.tpl");
	}
	
	function showOne($params) {
	    $request = fvRequest::getInstance();
        if (!$Partners = PartnersManager::getInstance()->getByPk($request->getRequestParameter('id'))) {
            $Partners = new Partners();
            
        }
        $this->__assign(array(
            'Partners' => $Partners,
        ));
        return $this->__display('partners_one.tpl');
	}
	
	function showBlock() {
		$request = fvRequest::getInstance();
		$Partners = PartnersManager::getInstance()->getAll(null, "rand()", "0,3");
	    $this->__assign('Partners', $Partners);
	    return $this->__display("partners_block.tpl");
	}
	
}
?>